<?php
/**
 * @package quizzes
 * @author Andrew Meredith <andymeredith@gmail.com>
 */
namespace PhpQuizzes;

/**
 * This class represents a personality
 * A Personality is assigned to a user upon completing a quiz. They may be created from
 * the administrative interface
 */
class Personality {
	/** @property int $_id The unique identifier of this personality object in the database */
	private $_id;
	
	/** @property string $_name The name for this personality */
	private $_name;
	
	/**
	 * @property string $_description Text used to describe the personality.
	 * This is what is displayed to a user upon completion of a quiz
	 */
	private $_description;
	
	/** @property string $_image The path to the image for this personality (if any) */
	private $_image;
	
	public function getId() {
		return $this->_id;
	}
	public function setId( $id ) {
		if (is_int( $id )) {
			$this->_id = $id;
		} else {
			throw new InvalidArgumentException("Invalid ID supplied. Expected an integer, but got '$id'");
		}
	}
	
	public function getName() {
		return $this->_name;
	}
	public function setName( $name ) {
		$this->_name = $name;
	}
	
	public function getDescription() {
		return $this->_description;
	}
	public function setDescription( $description ) {
		$this->_description = $description;
	}
	
	public function getImage() {
		return $this->_image;
	}
	public function setImage( $image ) {
		if( true ) { //TODO: replace with an actual test of whether this is a valid dir
			$this->_image = $image;
		} else {
			throw new InvalidArgumentException(
					"Invalid image path specified. Expected a directory path, but got '$image'");
		}
	}
}